<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <!-- ## 2. 反转字符串

    ```javascript
    var str = 'abcdefg'
    
    // 要求结果
    // gfedcba -->
    <script>
        var str = 'abcdefg';
        var res=str.split('');
        var res1=res.reverse();
        var res2=res1.join('');
    </script>
</body>

</html>